import Router from "koa-router"
import SystemController from "../controller/System.Controller"
import DataController from "../controller/Admin/Data.Controller"
import AnayleController from "../controller/Admin/Anayle.Controller"
import ErrorController from "../controller/Admin/Error.Controller"
let router = new Router({prefix:"/admin"})

// 1. 数据模块
router.get("/getData",DataController.getData)
router.get("/downLoadDate",DataController.downLoadDate)
router.post("/downloadRunDate",DataController.downloadRunData)
router.get("/getItem",DataController.getItem)
router.post("/saveData",DataController.saveDataList)
router.get("/getStatusList",DataController.getStatusList)
router.get("/deleteData",DataController.isDel,DataController.deleteData) //定期删除数据
router.get("/getInitialData",DataController.getInitialData) // 获取初始化数据值

// 数据分析模块
router.get("/getAnayleRecord",AnayleController.getAnayleRecord.bind(AnayleController))
router.get("/getHistory",AnayleController.getHistoryData.bind(AnayleController))                // 获取指定设备的历史状态   

// 3. 错误模块
router.get("/getErrorList",ErrorController.getErrorList) // 获取报警信息列表
router.post("/addErrorRecord",ErrorController.addErrorList) // 添加报警信息
router.delete("/removeErrorRecord",ErrorController.removeErrorInfo) // 删除错误记录
router.put("/updateErrorState",ErrorController.updateErrorState) // 修改报警的状态 0 => 待解决  1 => 进行中 2 => 已解决
router.get("/getErrorNum",ErrorController.getErrorNum) // 获取报警统计今天、一周、一个月报警次数
router.get("/getErrorStatsByModule",ErrorController.getErrorStatsByModule) // 新增：按网关IP、模块ID、类型ID和日期分组统计报警次数
router.get("/getErrorStatsByType",ErrorController.getErrorStatsByType) // 新增：根据类型查询报警统计
router.get('/getSortPoint',ErrorController.getErrorStatsByGatewayIp) // 获取监测点报警统计

// 4. 系统模块
router.get("/getDebugMode",SystemController.getDebugMode) // 获取调试模式

export default router
